# ruoyi-monitor/Dockerfile
#FROM openjdk:8-jdk-alpine3.7
FROM 192.168.7.104:8900/library/my-openjdk:8-jdk-alpine3.7
USER root
# 1. 仅创建用户（复用基础镜像的 appgroup）
#RUN adduser -S appuser -G appgroup

# 2. 初始化工作目录并设置权限
WORKDIR /app
RUN chown appuser:appgroup /app

# 3. 定义构建参数及环境变量
ARG PROFILE=dev
ENV SPRING_PROFILES_ACTIVE=$PROFILE

# 4. 切换到非特权用户
USER appuser

# 5. 复制文件并修正用户组名
COPY --chown=appuser:appgroup target/*.jar app.jar

# 6. 声明端口及健康检查
EXPOSE 9201

# 7. 入口点配置（进程ID优化:解决 pid 为 1 的问题)
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["java",  "-Duser.timezone=Asia/Shanghai", "-Dfile.encoding=UTF-8", "-jar", "app.jar"]

HEALTHCHECK --interval=30s --timeout=3s \
  CMD wget -q -O /dev/null http://localhost:9201/actuator/health || exit 1